﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.Unity;
using SettingModule.Views.SettingView;
using ELMWCFServiceClass.ELMWCF;
using SettingModule.Views.FieldSettingView;
using ELMApplication.Common.Const;
using Microsoft.Practices.Composite.Modularity;
using SettingModule.Views.UserInfoSettingView;
using SettingModule.Views.ELMListConfigView;
using SettingModule.Views.ELMItemsView;

namespace SettingModule
{
    public class SettingModule:IModule
    {
        private readonly IRegionManager regionManager;
        private readonly IUnityContainer container;
        public SettingModule(IRegionManager regionManager, IUnityContainer container)
        {
            this.regionManager = regionManager;
            this.container = container;
        }

        #region IModule Members

        public void Initialize()
        {
            registerViewsAndServices();
            regionManager.RegisterViewWithRegion(RegionNames.Setting.ToString(), () => container.Resolve<ISettingPresentationModel>().View);
        }
        protected void registerViewsAndServices()
        {


            container.RegisterType<ELMServiceClient>(new InjectionConstructor());
            container.RegisterType<ISettingView, SettingView>();
            container.RegisterType<ISettingPresentationModel, SettingPresentationModel>();
            container.RegisterType<IFieldSettingView, FieldSettingView>();
            container.RegisterType<IFieldSettingPresentationModel, FieldSettingPresentationModel>();
            container.RegisterType<IUserInfoSettingView, UserInfoSettingView>();
            container.RegisterType<IUserInfoSettingPresentationModel, UserInfoSettingPresentationModel>();
            container.RegisterType<IELMListConfigView, ELMListConfigView>();
            container.RegisterType<IELMListConfigPresentationModel, ELMListConfigPresentationModel>();
            container.RegisterType<IELMItemsView, ELMItemsView>();
            container.RegisterType<IELMItemsPrentationModel, ELMItemsPrentationModel>();


        }

        #endregion
    }
}
